package cn.copera.dyy.entity;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import cn.copera.dyy.common.persistence.IdEntity;
/**
 * 店面实体对象
 * @author Administrator
 *
 */
@Entity
@Table(name = "ka_shop")
@DynamicInsert
@DynamicUpdate
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Shop extends IdEntity<Shop> {
	private static final long serialVersionUID = 1L;
	private String loginName;//登陆账号
	private String shopName;// 店名
	private String phone;// 电话
	private String password;// 密码
	private String address;// 密码
	private String code;// 二维码
	private String headImage;// 头像
	private Shop parent;//所在店铺，二级用户使用
	private String uploadFlag;//上传完毕标志
	private String total_count;//点赞总数
	private String total_count1;//分享总数
	private String validDate = "";//有效期限

	public String getUploadFlag() {
		if(uploadFlag==null){
			uploadFlag="no";
		}
		return uploadFlag;
	}

	public void setUploadFlag(String uploadFlag) {
		this.uploadFlag = uploadFlag;
	}

	public String getShopName() {
		return shopName;
	}

	public void setShopName(String shopName) {
		this.shopName = shopName;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getHeadImage() {
		if(headImage==null||headImage.equals("")){
			headImage="无";
		}
		return headImage;
	}

	public void setHeadImage(String headImage) {
		this.headImage = headImage;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name="parent_id")
	@NotFound(action = NotFoundAction.IGNORE)
	
	public Shop getParent() {
		return parent;
	}

	public void setParent(Shop parent) {
		this.parent = parent;
	}

	public String getTotal_count() {
		if(total_count==null||total_count.equals("")){
			return "0";
		}
		return total_count;
	}

	public void setTotal_count(String total_count) {
		this.total_count = total_count;
	}

	public String getLoginName() {
		return loginName;
	}

	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	public String getTotal_count1() {
		if(total_count1==null||total_count1.equals("")){
			return "0";
		}
		return total_count1;
	}

	public void setTotal_count1(String total_count1) {
		this.total_count1 = total_count1;
	}

	public String getValidDate() {
		if(validDate==null||validDate.equals("")){
			validDate="无";
		}
		return validDate;
	}

	public void setValidDate(String validDate) {
		this.validDate = validDate;
	}
    
}
